-
Notifications
You must be signed in to change notification settings - Fork 917
fix: recalculate rowHeight() when isVirualized #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: recalculate rowHeight() when isVirualized #269
Conversation
When rendering rows with isVirualized, if rowHeight is a func, the virtualized list was not recalculating the rowHeight. Per the `react-virtualized` docs [here](https://github.com/bvaughn/react-virtualized/blob/master/docs/Lis t.md#recomputerowheights-index-number), `List.recomputeRowHeights()` needs to be called. This only fixes the dynamic rowHeight issue _after_ dragging a node is finished. An additional `List.recomputeRowHeights()` will need to be called to fix the ‘preview’ while dragging a row (see issue below for more details). This partially fixes [Issue 264](frontend-collective#264).
Pull Request Test Coverage Report for Build 184
💛 - Coveralls |
@@ -634,6 +636,9 @@ class ReactSortableTree extends Component { | |||
{({ height, width }) => ( | |||
<ScrollZoneVirtualList | |||
{...scrollToInfo} | |||
ref={el => { | |||
this.scrollZoneVirtualListComponent = el |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/fritz-c/react-sortable-tree/blob/master/src/react-sortable-tree.js#L98
The element is already defined.
@jcalebj This seems like a good idea. you can possible use the Thus we wouldn't have to split up the fixes. Also, it'll be nice if you can also write a test case for this :) |
@wuweiweiwu On it 👍 |
@jcalebj you mean the rowHeight updating while dragging? In that case I would checkout https://github.com/fritz-c/react-sortable-tree/blob/master/src/react-sortable-tree.js#L347 |
394ab8b
to
6c433d5
Compare
Not sure why this was closed, this issue still exists. If isVirtualized is true and rowHeight is a function, the node heights do not change value even after dropped. |
When rendering rows with isVirualized, if rowHeight is a func, the
virtualized list was not recalculating the rowHeight.
Per the
react-virtualized
docshere,
List.recomputeRowHeights()
needs to be called.
This only fixes the dynamic rowHeight issue after dragging a node is
finished. An additional
List.recomputeRowHeights()
will need to becalled to fix the ‘preview’ while dragging a row (see issue below for
more details).
This partially fixes Issue 264.